<!-- 订单管理列表页 -->
<template>
	<view v-if="shenheStatus == 0" class="page-list">
		<!--  <view class="page-header">
      <view class="search-section">
        <view class="input-box">
          <u-search
            :placeholder="$t('mdAdmin.orderNo')"
            v-model="keyword"
            :show-action="false"
            @search="gotoSearch"
          ></u-search>
        </view>
      </view>
      <view class="top-tabs">
        <view class="content-left">
          {{ searchDate ? searchDate : $t('person.allOrder') }}
        </view>
        <picker
          mode="date"
          :value="searchDate"
          :fields="'month'"
          @change="datePickerChange"
        >
          <view class="content-right">
            <i class="iconfont icon-filter"></i>
            <text>{{ $t('mdAdmin.queryTime') }}</text>
          </view>
        </picker>
      </view>
    </view> -->
		<!--   <view class="page-body">
      <view
        class="list-item"
        v-for="(item, index) in listData"
        :key="index"
        @click.stop="showDetail(item)"
      >
        <view class="order-num">
          <view class="order-no"
            >{{ $t('clerk.orderNum') }}：{{ item.order_no }}</view
          >
          <view class="status" :class="item.trade_status >= 0 ? 'status-red' : ''">{{
            item | transOrderStatus
          }}</view>
        </view>
        <view class="order-goods">
          <goodsDetail :orderitem="item"></goodsDetail>
        </view>
      </view>
    </view> -->

		<!--  <u-popup
      mode="bottom"
      v-model="showGoodsPopup"
      :z-index="121"
      border-radius="24"
      safe-area-inset-bottom
    >
      <view class="popup-body">
        <view class="popup-header">
          <view class="header-title" v-if="currentGoods.goods_list"
            >{{ $t('submit.list') }}({{ $t('admin.total1')
            }}{{ currentGoods.goods_list.length }})</view
          >
          <view class="close-box" @click="showGoodsPopup = false">
            <i class="iconfont icon-close"></i>
          </view>
        </view>
        <view class="popup-list">
          <view class="goods-list">
            <view
              class="goods-item"
              v-for="(item, index) in currentGoods.goods_list"
              :key="index"
            >
              <goodsDetail
                :isNodeOne="true"
                :nodeItem="item"
                :orderitem="currentGoods"
              ></goodsDetail>
            </view>
          </view>
        </view>
      </view>
    </u-popup> -->
		<!-- 新增 -->
		<view>
			<!-- 头部搜索栏 -->
			<view class="df_center bgF paddingS">
				<view class="">
					<u-search :input-style="{width:'580rpx',height:'64rpx'}" :show-action="false" height="64rpx"
						bg-color="#F2F2F2" placeholder="请输入订单号称或昵称" v-model="keyword" @change="gotoSearch"></u-search>
				</view>
				<!-- <view class="seleIconStyle" @click="iconChange">
					<view class="iconfont" :class="{colorRed:checkShow}" style="font-size: 60rpx;">&#xe751;</view>
				</view> -->
			</view>

			<!-- 切换栏 -->
			<view class="bgF p24 fsTyle">
				<scroll-view class="scroll-view_H" scroll-x="true">
					<view class="" style="display: flex;align-items: center;">
						<view v-for="(item,index) in select_classificationArr" :key="index"
							class="seleltClassification scroll-view-item_H" :class="status==item.status ? 'active':''"
							@click="selelt_classification(item.status)">{{item.name}}</view>
					</view>
				</scroll-view>
				<view class="iconStyle" @click="stateDetails">
					<view class="iconfont" :class="{colorRed:stateShow}" style="font-size: 50rpx;">&#xe82b;</view>
				</view>
			</view>

			<!-- 切换栏2 -->
			<view class="switchContent" v-if="stateShow">
				<text :class="status==item.status ? 'active1':''" class="switchContentText mr24"
					v-for="(item,index) in select_classificationArr" :key="index"
					@click="selelt_classification(item.status)">
					{{item.name}}
				</text>
			</view>

			<!-- 商品栏 -->
			<view class="" style="padding: 0rpx 24rpx 24rpx 24rpx;" v-if="listData.length!=0">
				<u-checkbox-group shape="circle" placement="column" @change="checkboxChange">
					<view class="df_a_center mt24" v-for="(item, index) in listData" :key="index">
						<view v-if="checkShow" class=""
							style="display: flex;justify-content: center; align-items: center; ">
							<u-checkbox activeColor="#F0250E" :name="item.order_id" v-model="item.checked">
							</u-checkbox>
						</view>
						<view class="content">
							<view class="df_a_center_j_b mb24">
								<view class="orderTime">
									下单时间：{{item.created_at}}
								</view>
								<view class="stockUp">
									{{item.trade_status_text}}
								</view>
							</view>


							<!-- 商品详细信息 -->
							<view v-if="item.goods_list.length<=4" class="casd"
								v-for="(item1,index1) in item.goods_list" :key="index1" @click.stop="showDetail(item)">
								<view class=""
									style="width:140rpx;height:140rpx;background: #F6F6F6;border-radius: 10rpx 10rpx 10rpx 10rpx;">
									<image
										style="width:140rpx;height:140rpx;background: #F6F6F6;border-radius: 10rpx 10rpx 10rpx 10rpx;"
										:src="item1.goods_pic" mode=""></image>
								</view>
								<view class="">
									<view class="introduce">
										{{item1.goods_name}}
									</view>
									<view class="salesVolume" v-if="item1.attr.length">
										<text v-for="(content,id) in item1.attr" :key="id">
											{{content.attr_group_name}},{{content.attr_name}}
										</text>
									</view>
								</view>
								<view class="">
									<view class="moneyConter">
										￥{{item1.price}}
									</view>
									<view class="numConter">
										X{{item1.num}}
									</view>
								</view>
							</view>
							<view v-if="item.goods_list.length>4" class="casd1" @click.stop="showDetail(item)">
								<view class="casd1Img" v-for="(item1,index1) in item.goods_list.slice(0, 3)"
									:key="index1">
									<image
										style="width:140rpx;height:140rpx;background: #F6F6F6;border-radius: 10rpx 10rpx 10rpx 10rpx;"
										:src="item1.goods_pic" mode=""></image>
								</view>
								<view class=""
									style="display: flex; justify-content: flex-end;flex-grow: 1; color: #8C8C8C;">
									共{{item.goods_list.length}}件
									<u-icon color="#8C8C8C" name="arrow-right"></u-icon>
								</view>
							</view>

							<view class="content_operate">
								<view class="df">
									<view class="csh">买家留言</view>
									<view class="ml20 buyer">{{item.remark?item.remark:'无留言'}}</view>
								</view>
								<view class="df" style="margin-top: 10rpx;">
									<view class="csh">商家备注</view>
									<view class="ml20 buyer">{{item.words?item.words:'无备注'}}</view>
								</view>
							</view>
							<view class="surePickup">
								<view v-if="item.is_offline==1" class="surePickupName">
									<text>自提信息</text><text
										style="margin-left: 20rpx;">{{item.address_name}}/{{item.address_mobile}}</text>
								</view>
								<view v-if="item.is_offline==0" class="surePickupName" style="display: flex;">
									<view>发货信息</view>
									<view class="" style="margin-left: 20rpx;">
										<view>{{item.address_name}}/{{item.address_mobile}}</view>
										<view>{{item.address}}</view>
									</view>
								</view>

								<view class="btnstyle" v-if="item.apply_delete!=1&&item.refund==null">
									<view class="deldeStyle" @click="remarks(item.order_id)">
										备注
									</view>
									<!-- -1默认(待支付) 0待发货 1已取消  2已发货  3已完成-->
									<view v-if="item.trade_status==0 || item.trade_status==-1" class="sureStyle ml14"
										@click="cancelOrder(item.order_id)">
										取消订单
									</view>
									<view v-if="item.trade_status==1 ||item.trade_status==3" class="sureStyle ml14"
										@click="deleteOrder(item.order_id)">
										删除订单
									</view>
									<view v-if="item.trade_status==0" class="sureStyle ml14"
										@click="sureDelivery(item.order_id,item.is_offline)">
										立即发货
									</view>
									<view v-if="(item.trade_status==0|| item.trade_status==2) && item.is_offline==1"
										class="sureStyle ml14" @click="sureGoods(item.order_id)">
										确认核销
									</view>
								</view>
								<!-- 订单操作 -->
								<view class="btnstyle" v-if="item.apply_delete==1&&item.refund==null">
									<view v-if="item.trade_status!=1" class="sureStyle ml14"
										@click="postOrderCancellation(item.order_id,1)">
										同意取消
									</view>
									<view v-if="item.trade_status!=1" class="sureStyle ml14"
										@click="postOrderCancellation(item.order_id,2)">
										拒绝取消
									</view>
									<view v-if="item.trade_status==1" class="sureStyle ml14"
										@click="deleteOrder(item.order_id)">
										删除订单
									</view>
								</view>
								<!-- 售后操作 -->
								<view class="btnstyle" v-if="item.refund!=null&&!item.refund.status">
									<template v-if="!item.refund.is_agree">
										<view v-if="item.refund.is_user_send!=1" class="sureStyle ml14"
											@click="afterSalesOrderNOT(item.refund.id)">
											拒绝申请
										</view>
										<view v-if="item.refund.is_user_send!=1" class="sureStyle ml14"
											@click="afterSalesOrderTUI(item.refund.id,2)">
											退款退货
										</view>
									</template>
									
									<!-- <view v-if="item.refund.is_user_send!=1" class="sureStyle ml14"
										@click="afterSalesOrderHUAN(item.refund.id)">
										换货
									</view> -->
									<view v-else  class="sureStyle ml14"
										@click="afterSalesOrderSURE(item.refund.id)">
										确认收货
									</view>	
								</view>
							</view>
						</view>
					</view>
				</u-checkbox-group>
			</view>
			<view class="nos " v-if="listData.length==0">
				<view class="iconfont" style="font-size: 80rpx;">&#xe7b7;</view>
				<view class="" style="margin-top: 10rpx;">
					暂无订单
				</view>
			</view>
		</view>
		<!-- 底部全选 -->
		<!-- 	<view class="footer" v-if="checkShow">
			<view class="footerCheckBox" @click="checkedAll">
				<view class="footerText">
					<radio style="transform: scale(0.8)" color="#FA3534" value="r1" :checked="checkAll" />选中
				</view>
			</view>
			<view class="footerBtn">
				<view class="" style="width: 136rpx;">
					<u-button type="error" shape="circle">通知</u-button>
				</view>
				<view class="" style="width: 192rpx; margin-left: 24rpx;">
					<u-button type="error" shape="circle">确认自提</u-button>
				</view>
			</view>
		</view> -->

		<!-- 确认发货弹出框 -->
		<view>
			<u-popup v-model="show" border-radius="24" mode="bottom" :closeable="true">
				<view class="" style="padding: 28rpx 36rpx;">
					<view class="surecash">确认发货</view>
					<view class="surecash_mode">
						发货方式
					</view>
					<!-- 快递时可选择快递可选择无需物流 -->
					<view class="logistics" v-if="is_offline==0">
						<view class="logisticsfa mr24" :class="{'bgF60313':shippingMethod==0}" @click="sureshipping(0)">
							快递发货
						</view>
						<view class="logisticsfa" :class="{'bgF60313':shippingMethod==1}" @click="sureshipping(1)">
							无需物流
						</view>
					</view>
					<!-- 自提时只能选择无需物流 -->
					<view class="logistics" v-if="is_offline==1">
						<view class="logisticsfa" :class="{'bgF60313':shippingMethod==1}"
							@click="sureshipping(is_offline)">
							无需物流
						</view>
					</view>
					<view class="" v-if="shippingMethod==0">
						<view class="surecash_mode1">
							快递公司
						</view>
						<view class="logisticsMasion" @click="selectCompanies">
							<view class="logisticsMasion_select">
								<u-input :disabled="true" v-model="express" placeholder="请选择快递公司"
									placeholder-style="color: #B6B6B6;" />
							</view>
							<view class="">
								<u-icon color="#B6B6B6" size="20rpx" name="arrow-right"></u-icon>
							</view>
						</view>
						<view class="surecash_mode1">
							快递单号
						</view>
						<view class="logisticsMasionbian">
							<u-input v-model="postalCode" placeholder="请输入快递单号" placeholder-style="color: #B6B6B6;" />
						</view>
					</view>
					<view class="confirmShipment" @click="confirmShipmentMethods">
						确定
					</view>
				</view>
			</u-popup>
		</view>
		<!-- 选择快递公司 -->
		<view>
			<u-select v-model="selectComp" title="选择快递" :list="expressList" @confirm="confirm"></u-select>
		</view>
		<!-- 备注弹出框 -->
		<u-popup v-model="businessRemarks" border-radius="24" mode="center" :closeable="true">
			<view class="" style="height: 400rpx; width: 600rpx; padding: 30rpx;">
				<view class="" style="display: flex;justify-content: center;">
					商家备注
				</view>
				<view class="ipSty">
					<u-input placeholder="请输入备注" v-model="remarksValue" type="textarea " :border="true"
						:auto-height="true" />
				</view>
				<view class="" style="margin-top: 50rpx;">
					<u-button type="error" shape="circle" @click="sureRemarks">确认</u-button>
				</view>
			</view>
		</u-popup>
		<!-- 拒绝理由弹出框 -->
		<u-popup v-model="showNotOrder" mode="center" :closeable="true" border-radius="24">
			<view  style="height: 400rpx; width: 600rpx; padding: 30rpx;">
				<view class="" style="display: flex;justify-content: center;">
					拒绝理由
				</view>
				<view class="ipSty">
				    <u-input placeholder="请输入拒绝理由" v-model="notOrderValue" type="textarea" :border="true" :auto-height="true" />
				</view>
				<view class="" style="margin-top: 50rpx;">
					<u-button type="error" shape="circle" @click="notOrderSure">确认拒绝</u-button>
				</view>
			</view>
		</u-popup>
		<!-- 退货退款弹窗 -->
		<u-popup v-model="showPas" mode="center" :closeable="true" border-radius="24">
			<view  style="height: 400rpx; width: 600rpx; padding: 30rpx;">
				<view class="" style="display: flex;justify-content: center;">
					同意退货
				</view>
				<view class="ipSty">
				    <u-input @click="showListTrue" :disabled=true placeholder="请选择地址" v-model="address_name" type="text" :border="true" :auto-height="true" />
				</view>
				<u-select label-name="name" value-name="id" v-model="showList" :list="newListOJ" @confirm="confirm1"></u-select>
				<view class="" style="margin-top: 50rpx;">
					<u-button type="error" shape="circle" @click="notOrderSure1">确认选择</u-button>
				</view>
			</view>
		</u-popup>
		
		
		
		<view class="" style="display: flex;justify-content: center;color: #8C8C8C; margin-top: 20rpx;">
			{{prompt}}
		</view>
	</view>
	<Shenhe v-else-if="shenheStatus == 1"></Shenhe>
</template>

<script>
	import Shenhe from '@/components/shenhe/shenhe';
	import goodsDetail from '../components/goodsDetail/index.vue';
	import {
		storeAdminGetExpress
	} from "@/api/admin";

	export default {
		components: {
			goodsDetail,
			Shenhe,
		},
		data() {
			return {
				// 售后
				address_id:'',
				address_name:'',
				showPas:false,
				showList:false,
				newListOJ:{},
				// 拒接弹窗
				showNotOrder:false,
				notOrderValue:'',
				orderIDS:'',
				orderVlue:'',
				// 滑块位置
				status: -1,
				// 下拉提示
				prompt: '—— 下拉加载更多！——',
				// 商家备注输入框
				remarksValue: '',
				// 商家备注弹框
				businessRemarks: false,
				// 快递单号输入框
				postalCode: '',
				// 快递公司输入框
				express: '',
				// 选择快递方式选择器显示隐藏
				selectComp: false,
				// 控制发货方式样式
				shippingMethod: 0,
				// 立即发货弹出框显示隐藏
				show: false,
				// 动态判断复选框的显示和隐藏
				checkShow: false,
				// 动态控制状态详情显示隐藏
				stateShow: false,
				// 搜索框双向绑定的值
				keyword: '',
				// 底部全选按钮值
				checkAll: false,
				// 复选框
				checkboxValue1: [],

				// 滑块数据
				select_classificationArr: [{
						status: -1,
						name: "全部"
					},
					{
						status: 0,
						name: "待支付"
					},
					{
						status: 1,
						name: "已支付"
					},
					{
						status: 3,
						name: "已发货"
					},
					{
						status: 4,
						name: "已完成"
					},
					{
						status: 5,
						name: "待售后"
					},
					
				],
				//快递数据
				expressList: [],
				order_id: null,
				is_offline: null,
				next: null,
				// 门店id
				md_id: null,

				// 旧的
				listData: [],
				page: 1,
				pageSize: 20,
				row_count: 0,
				no_clerk_count: 0,
				searchDate: '',
				showGoodsPopup: false,
				currentGoods: {},
			};
		},
		filters: {
			transOrderStatus(val) {
				let text = "未支付";
				switch (val.trade_status) {
					case 0:
						text = "待发货";
						//if(val.is_offline) text = '待核销' 
						break;
					case 1:
						text = "已取消";
						break;
					case 2:
						text = "已发货";
						if (val.is_offline) text = '待核销'
						break;
					case 3:
						text = "已完成";
						if (val.is_offline) text = '已核销'
						break;
				}
				return text;
			},
		},
		onLoad(t) {
			this.md_id = t.id
			if (t?.status) {
				this.status = t.status;
				// let index = this.select_classificationArr.findIndex((d, index) => {
				// 	return d.status == t.status;
				// });
				// this.status = index;
			}
		},
		onReachBottom() {
			if (this.page * this.pageSize >= this.row_count) {
				this.prompt = '—— 没有更多订单了！——'
				return;
			}
			this.page++;
			this.getListData({
				page: this.page,
				status: this.status,
				keyword: this.keyword,
				loadMore: true,
				limit: this.pageSize
			});
		},
		computed: {},
		onShow() {
			this.page = 1,
				prompt = '—— 下拉加载更多！——',
				this.getListData({
					page: this.page,
					limit: this.pageSize,
					keyword: this.keyword,
					status: this.status,
					time: this.searchDate,
				});	
		},
		watch: {},
		methods: {
			// 用户申请取消订单
			postOrderCancellation(id, value) {
				this.orderIDS=id
				this.orderVlue=value
				if(value==2&&this.showNotOrder==false){
					this.showNotOrder=true
					return
				}
				this.$allrequest.mdAdmin.orderCancellation({
					order_id: this.orderIDS,
					remark: this.notOrderValue,
					status: this.orderVlue,  // 正确的赋值语法
				}).then(res => {
					if (!res.code) {
						uni.showToast({
							title: res.msg,
							icon: 'none',
						});
						this.page = 1
						this.prompt = '—— 下拉加载更多！——'
						this.manyUs()
						this.getListData({
							page: this.page,
							status: this.status,
							keyword: this.keyword,
							limit: this.pageSize
						});
					}
					this.showNotOrder=false
				});
			},
			// 确认拒绝
			notOrderSure(){
				this.postOrderCancellation(this.orderIDS, this.orderVlue)
			},	
			// 售后处理-退货退款
			afterSalesOrderTUI(val,value){
				this.orderIDS=val
				if(value==2&&this.showPas==false){
					this.showPas=true
					return
				}
				this.$allrequest.mdAdmin.salesOrders({
					order_refund_id: this.orderIDS,
					action:1,
					refund:0,
					address_id:this.address_id
				}).then(res => {
					if (!res.code) {
						uni.showToast({
							title: res.msg,
							icon: 'none',
						});
						this.page = 1
						this.prompt = '—— 下拉加载更多！——'
						this.manyUs()
						this.getListData({
							page: this.page,
							status: this.status,
							keyword: this.keyword,
							limit: this.pageSize
						});
						
					}
					this.showPas=false
				});
			},
			
			// 售后处理-确认收货
			afterSalesOrderSURE(val){
				this.orderIDS=val
				this.showList=true
				this.$allrequest.mdAdmin.salesOrders({
					order_refund_id: this.orderIDS,
					action:1,
					refund:1,
				}).then(res => {
					if (!res.code) {
						uni.showToast({
							title: res.msg,
							icon: 'none',
						});
						this.page = 1
						this.prompt = '—— 下拉加载更多！——'
						this.manyUs()
						this.getListData({
							page: this.page,
							status: this.status,
							keyword: this.keyword,
							limit: this.pageSize
						});
						
					}
				});
			},
			// 拒绝申请
			afterSalesOrderNOT(val){
				this.orderIDS=val
				this.$allrequest.mdAdmin.salesOrders({
					order_refund_id: this.orderIDS,
					action:2,
					refund:0,
					address_id:this.address_id
				}).then(res => {
					if (!res.code) {
						uni.showToast({
							title: res.msg,
							icon: 'none',
						});
						this.page = 1
						this.prompt = '—— 下拉加载更多！——'
						this.manyUs()
						this.getListData({
							page: this.page,
							status: this.status,
							keyword: this.keyword,
							limit: this.pageSize
						});
						
					}
				});
			},
			confirm1(e) {
				this.address_name=e[0].label
				this.address_id=e[0].value
			},
			showListTrue(){
				this.showList=true
			},
			notOrderSure1(){
				this.afterSalesOrderTUI(this.orderIDS,1)
			},
			
			
			
			// 取消订单
			cancelOrder(order_id) {
				this.$allrequest.mdAdmin.cancelOreder({
					md_id: this.md_id,
					order_id: order_id
				}).then(res => {
					if (!res.code) {
						uni.showToast({
							title: res.msg,
							icon: 'success',
							duration: 1500
						});

						// 调取接口再次回显数据
						this.page = 1
						this.prompt = '—— 下拉加载更多！——'
						this.manyUs()
						this.getListData({
							page: this.page,
							status: this.status,
							keyword: this.keyword,
							limit: this.pageSize
						});
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none',
						});
					}
				})
			},
			// 点击快递选择器确定返回数据
			confirm(value) {
				this.express = value[0].label
			},

			// 点击立即发货中的最终确定按钮（保存数据）
			confirmShipmentMethods() {
				// 两个状态this.is_offline==1为自提直接提交
				if (this.is_offline == 1) {
					// 直接写参数带过去
					this.next = {
						order_id: JSON.stringify(this.order_id)
					}
				}

				// this.is_offline==0为快递，快递需要判断表单检验，传递表单数据
				if (this.is_offline == 0) {
					if (!this.express) {
						uni.showToast({
							icon: 'error',
							title: '快递公司不能为空!',
							duration: 1500
						});
						return
					}
					if (!this.postalCode) {
						uni.showToast({
							icon: 'error',
							title: '快递单号不能为空!',
							duration: 1500
						});
						return
					}
					// 这里写参数带过去
					this.next = {
						order_id: JSON.stringify(this.order_id),
						express: this.express,
						express_no: this.postalCode
					}
				}
				this.$allrequest.mdAdmin.sendSelfMentionOrder(this.next).then(res => {
					if (!res.code) {
						uni.showToast({
							title: res.msg,
							icon: 'success',
						});
						this.show = false
						// 调取接口再次回显数据
						this.page = 1
						this.prompt = '—— 下拉加载更多！——'
						this.manyUs()
						this.getListData({
							page: this.page,
							status: this.status,
							keyword: this.keyword,
							limit: this.pageSize
						});

					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none',
						});
					}
				})
			},
			// 选择发货样式
			sureshipping(value) {
				this.shippingMethod = value
				this.is_offline = value
			},
			// 点击立即发货弹出框
			sureDelivery(order_id, is_offline) {
				// 传递当前订单为自提还是快递状态
				this.is_offline = is_offline
				if (this.is_offline == 1) {
					this.shippingMethod = 1
				} else if (this.is_offline == 0) {
					this.storeAdminGetExpress();
					this.shippingMethod = 0
				}
				// 获取订单id
				this.order_id = [order_id]
				this.show = true
				// 其他状态清除
				this.manyUs()
			},
			// 点击确认核销
			sureGoods(order_id) {
				this.order_id = [order_id]
				// 其他状态清除
				this.manyUs()
				this.$allrequest.mdAdmin.clerkSelfMentionOrder({
					order_id: JSON.stringify(this.order_id)
				}).then(res => {
					if (!res.code) {
						uni.showToast({
							title: res.msg,
							icon: 'success',
						});
						// 调取接口再次回显数据
						this.page = 1
						this.prompt = '—— 下拉加载更多！——'
						this.manyUs()
						this.getListData({
							page: this.page,
							status: this.status,
							keyword: this.keyword,
							limit: this.pageSize
						});
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none',
						});
					}
				});
			},
			// 删除订单
			deleteOrder(order_id) {
				let that = this;
				uni.showModal({
					title: this.$t('order.prompt'),
					content: this.$t('mdAdmin.confirmCancle'),
					success: function(res) {
						if (res.confirm) {
							that.$allrequest.order
								.delete({
									order_id: order_id,
								})
								.then(res => {
									uni.showToast({
										title: res.msg,
										icon: 'success',
									});
									// 调取接口再次回显数据
									that.page = 1
									that.prompt = '—— 下拉加载更多！——'
									that.manyUs()
									that.getListData({
										page: that.page,
										status: that.status,
										keyword: that.keyword,
										limit: that.pageSize
									});

								});
						} else if (res.cancel) {
						}
					},
				});
			},
			// 控制滑块切换
			selelt_classification(index) {
				this.page = 1
				this.manyUs()
				this.status = index
				this.getListData({
					page: this.page,
					status: this.status,
					keyword: this.keyword,
					limit: this.pageSize
				});
			},
			// 关闭复选框，清除全选状态函数
			manyUs() {
				this.stateShow = false
				this.TemporaryStorage = ''
				this.checkShow = false
				this.checkAll = false
				this.listData.map(val => {
					val.checked = false;
				})
			},
			// 确认备注修改按钮
			sureRemarks() {
				this.$allrequest.mdAdmin.setRemarks({
					order_id: this.order_id,
					words: this.remarksValue
				}).then(res => {
					if (!res.code) {
						uni.showToast({
							title: res.msg,
							duration: 1500
						});
						// 调取接口再次回显数据
						this.page = 1
						this.prompt = '—— 下拉加载更多！——'
						this.manyUs()
						this.getListData({
							page: this.page,
							status: this.status,
							keyword: this.keyword,
							limit: this.pageSize
						});
					}
				});
				this.businessRemarks = false
			},
			// 备注
			remarks(order_id) {
				this.order_id = order_id
				// 输入框弹出
				this.businessRemarks = true
				this.manyUs()
			},
			// 控制列表详情显示与隐藏
			stateDetails() {
				this.stateShow = !this.stateShow
			},
			// 点击弹出快递选择器
			selectCompanies() {
				this.selectComp = true
			},

			// 获取快递参数
			storeAdminGetExpress() {
				storeAdminGetExpress().then((res) => {
					if (res.code === 0) {
						if (res.data.express.length) {
							this.expressList = res.data.express.map((el, i) => {
								return {
									label: el,
									value: i,
								};
							});
						}
					}
				});
			},	

			// 全选
			// checkedAll() {
			// 	this.checkAll = !this.checkAll
			// 	if (this.checkAll) {
			// 		let s1 = this.listData.map(val => {
			// 			val.checked = true;
			// 			return val.id
			// 		})
			// 		this.checkboxChange(s1)
			// 	} else {
			// 		let s1 = this.listData.map(val => {
			// 			val.checked = false;
			// 		})
			// 		this.checkboxChange(s1)
			// 	}

			// },
			// 复选框
			// checkboxChange(n) {
			// },

			//控制搜索右边icon状态变化和复选按钮的出现与隐藏
			// iconChange() {
			// 	this.checkShow = !this.checkShow
			// },








			// 旧的
			datePickerChange(e) {
				this.searchDate = e.target.value;
				this.page = 1;
				this.getListData({
					page: this.page,
					keyword: this.keyword,
					time: this.searchDate,
				});
			},
			getListData(params) {

				this.$allrequest.mdAdmin.getMdCenterOrderList(params).then(res => {

					if (!res.code) {
						res.data.list.forEach(d => {
							d.goods_list.forEach(k => {
								if (!k?.attr) {
									if (k?.attr_list) {
										k.attr = k.attr_list;
									}
								}
							});
						});
						if (params.loadMore) {
							this.listData = [...this.listData, ...res.data.list];
						} else {
							this.listData = res.data.list;
							if (!res.data.page_count) {
								this.prompt = ''
							} else if (res.data.row_count <= 4) {
								this.prompt = '—— 没有更多订单了！——'
							}
						}
						this.row_count = res.data.row_count;
						this.no_clerk_count = res.data.no_clerk_count;
						this.newListOJ=res.data.refund_address
					}
				});
			},
			tabsChange(index, item) {
				this.page = 1;
				this.getListData({
					page: this.page,
					time: this.searchDate,
					keyword: this.keyword,
				});
			},
			// 搜索
			gotoSearch(val) {
				this.page = 1;
				this.getListData({
					page: this.page,
					status: this.status,
					keyword: this.keyword,
					limit: this.pageSize
				});
			},
			// 跳转商品详情
			showDetail(item) {
				if (item.goods_list.length > 1) {
					this.currentGoods = item;
					this.showGoodsPopup = true;

				}
				this.$utils.toUrl("/md_admin/order-detail/order-detail?id=" + item.order_id, 'navigate');
				return;
			},
		},
	};
</script>

<style lang="scss" scoped>
	.nos {
	     margin-top: 300rpx;
		 text-align: center;
		 color: #C0C4CC;
	}

	.ipSty {
		width: 100%;
		margin-top: 40rpx;
	}

	.confirmShipment {
		width: 678rpx;
		height: 80rpx;
		margin: 0 auto;
		background: #F0250E;
		border-radius: 120rpx 120rpx 120rpx 120rpx;
		line-height: 80rpx;
		text-align: center;
		font-family: PingFang SC, PingFang SC;
		font-weight: 600;
		font-size: 32rpx;
		color: #FFFFFF;
		font-style: normal;
		text-transform: none;
		margin-top: 56rpx;
		margin-bottom: 20rpx;
	}

	.logistics {
		display: flex;
		align-items: center;
		padding: 24rpx 0rpx 30rpx 0rpx;
		border-bottom: 1px solid #F8F8F8;
	}

	.logisticsMasion {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 24rpx 0rpx 30rpx 0rpx;
		border-bottom: 1px solid #F8F8F8;
	}

	.logisticsMasionbian {
		padding: 20rpx 0rpx 0rpx 0rpx;
		border-bottom: 1px solid #F8F8F8;
	}

	.logisticsMasion_select {
		width: 196rpx;
		height: 40rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 28rpx;
		font-style: normal;
		text-transform: none;
	}

	.logisticsfa {
		width: 160rpx;
		height: 60rpx;
		background: #F2F2F2;
		border-radius: 120rpx 120rpx 120rpx 120rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #262626;
		line-height: 59rpx;
		text-align: center;
		font-style: normal;
		text-transform: none;
	}

	.bgF60313 {
		background: #FCEDEB;
		color: #F0250E;
		border: 2rpx solid #F60313;
		font-weight: 600;
	}

	.surecash {
		height: 44rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 600;
		font-size: 30rpx;
		color: #262626;
		font-style: normal;
		text-transform: none;
	}

	.surecash_mode {
		height: 40rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 600;
		font-size: 28rpx;
		color: rgba(29, 29, 29, 0.94);
		font-style: normal;
		text-transform: none;
		margin-top: 40rpx;

	}

	.surecash_mode1 {
		margin-top: 40rpx;
		height: 40rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 28rpx;
		color: rgba(29, 29, 29, 0.94);
		font-style: normal;
		text-transform: none;
	}

	.ml14 {
		margin-left: 14rpx;
	}

	.btnstyle {
		display: flex;
		justify-content: flex-end;
		align-items: center;
		margin-top: 24rpx;
	}

	.deldeStyle {
		padding: 8rpx 15rpx;
		height: 58rpx;
		background: #F2F2F2;
		border-radius: 120rpx 120rpx 120rpx 120rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #262626;
		text-align: center;
		display: flex;
		align-items: center;
		font-style: normal;
		text-transform: none;
	}



	.sureStyle {
		padding: 8rpx 15rpx;
		height: 58rpx;
		background: #FDF1F0;
		border-radius: 120rpx 120rpx 120rpx 120rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #F0250E;
		line-height: 58rpx;
		display: flex;
		align-items: center;
		text-align: center;
		font-style: normal;
		text-transform: none;
	}

	.surePickupName {
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #8C8C8C;
		font-style: normal;
		text-transform: none;
		padding: 24rpx 0rpx 24rpx 48rpx;
		border-bottom: 1px solid #F8F8F8;
	}

	.mr24 {
		margin-right: 24rpx;
	}

	.switchContent {
		width: 702rpx;
		margin: 0rpx auto;
		padding-top: 18rpx;

	}

	.switchContentText {
		border-radius: 120rpx;
		padding: 10rpx 24rpx;
		background-color: #fff;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #262626;
		font-style: normal;
		text-transform: none;
		line-height: 3;
		/* 设置行高，创建上方间距 */
	}

	.colorRed {
		color: #FA3534;
	}

	.footer {
		height: 140rpx;
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: #fff;
		padding: 14rpx 24rpx 34rpx 24rpx;
		position: fixed;
		bottom: 0;
	}

	.mb24 {
		margin-bottom: 24rpx;
	}

	.stockUp {
		height: 36rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 26rpx;
		color: #F0250E;
		font-style: normal;
		text-transform: none;
	}

	.orderTime {
		height: 36rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 26rpx;
		color: #8C8C8C;
		font-style: normal;
		text-transform: none;
	}

	.pricePlatform {
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #262626;
		font-style: normal;
		text-transform: none;
	}

	.moneyConter {
		height: 42rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 600;
		font-size: 28rpx;
		color: #262626;
		font-style: normal;
		text-transform: none;
		display: flex;
		justify-content: flex-end;
	}

	.numConter {
		height: 40rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 600;
		font-size: 24rpx;
		color: #8C8C8C;
		font-style: normal;
		text-transform: none;
		display: flex;
		justify-content: flex-end;
	}

	.money {
		font-family: PingFang SC, PingFang SC;
		font-weight: 600;
		font-size: 24rpx;
		font-style: normal;
		text-transform: none;
		color: #F0250E;
	}

	.mt22 {
		margin-top: 22rpx;
	}

	.ml24 {
		margin-left: 24rpx;
	}

	.salesVolume {
		width: 296rpx;
		height: 34rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #8C8C8C;
		font-style: normal;
		text-transform: none;
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		/* 控制行数 */
		-webkit-box-orient: vertical;
		text-overflow: ellipsis;
		margin-top: 10rpx;
	}

	.casd {
		display: flex;
		justify-content: space-between;
		width: 100%;
		margin-bottom: 15rpx;
	}

	.casd1 {
		display: flex;
		align-items: center;
		width: 100%;
	}

	.casd1Img {
		display: flex;
		align-items: center;
		margin-right: 30rpx;
	}

	.content {
		background-color: #fff;
		border-radius: 20rpx;
		padding: 24rpx;
		width: 100%;
	}

	.footerText {
		height: 44rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 32rpx;
		color: #262626;
		font-style: normal;
		text-transform: none;
		display: flex;
		align-items: center;
	}

	.footerCheckBox {
		display: flex;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 32rpx;
		color: #262626;
		font-style: normal;
		text-transform: none;
	}

	.footerBtn {
		display: flex;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 28rpx;
		color: #FFFFFF;
		font-style: normal;
		text-transform: none;
	}

	.introduce {
		width: 316rpx;
		height: 74rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 600;
		font-size: 28rpx;
		color: #262626;
		font-style: normal;
		text-transform: none;
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		/* 控制行数 */
		-webkit-box-orient: vertical;
		text-overflow: ellipsis;
	}

	.df_center {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.bgF {
		background-color: #FFF;
	}

	.paddingS {
		padding: 18rpx 15rpx 18rpx 24rpx;
	}

	.seleltClassification {
		margin: 20rpx 52rpx 0rpx 0rpx;
		padding-bottom: 24rpx;
		border-bottom: 3px solid #fff;
	}

	.active {
		border-bottom: 3px solid #F0250E !important;
		color: #F0250E;
		font-weight: 600;
	}

	.active1 {
		color: #F0250E;
	}

	.p24 {
		padding: 0rpx 24rpx;
	}

	.mt24 {
		margin-top: 24rpx;
	}

	.fsTyle {
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 28rpx;
		color: #262626;
		font-style: normal;
		text-transform: none;
		position: relative;
	}

	.df_a_center_j_b {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.df_a_center {
		display: flex;
		align-items: center;
	}

	.iconStyle {
		width: 88rpx;
		height: 85rpx;
		background: #FFFFFF;
		box-shadow: -4rpx 0rpx 4rpx 2rpx rgba(0, 0, 0, 0.05);
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		position: absolute;
		z-index: 999;
		right: 0;
		top: 0;
	}

	.seleIconStyle {
		display: flex;
		justify-content: flex-end;
		align-items: center;
	}

	.df {
		display: flex;
	}

	.buyer {
		width: 420rpx;
		white-space: nowrap;
		/* 防止文本换行 */
		overflow: hidden;
		/* 隐藏溢出的文本 */
		text-overflow: ellipsis;
		/* 显示省略号 */
	}

	.csh {
		width: 96rpx;
		height: 34rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #8C8C8C;
		font-style: normal;
		text-transform: none;
	}

	.content_operate {
		padding: 24rpx 0rpx 24rpx 48rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #8C8C8C;
		font-style: normal;
		text-transform: none;
		border-bottom: 1px solid #F8F8F8;
	}

	.ml20 {
		margin-left: 20rpx;
	}

	.page-list {
		width: 100%;
		min-height: 100vh;
		background: #f2f2f2;
		padding-bottom: calc(env(safe-area-inset-bottom) + 100rpx);

		.page-header {
			width: 100%;
			padding-top: 174rpx;

			.search-section {
				width: 100%;
				background-color: #ffffff;
				height: 84rpx;
				position: fixed;
				top: 0;
				left: 0;
				z-index: 111px;
				display: flex;
				align-items: center;
				justify-content: center;

				.input-box {
					width: 92vw;
				}
			}

			.top-tabs {
				width: 100%;
				height: 90rpx;
				background: #ffffff;
				position: fixed;
				left: 0;
				top: 84rpx;
				z-index: 111;
				display: flex;
				justify-content: space-around;
				align-items: center;

				.tab-item {
					flex: 1;
					display: flex;
					flex-direction: column;
					justify-content: center;
					align-items: center;

					.tab-text {
						font-size: 28rpx;
						font-family: PingFang SC;
						font-weight: 400;
						color: #262626;
					}

					.tab-active {
						width: 50rpx;
						height: 6rpx;
						background: #f0250e;
						margin-top: 4rpx;
						opacity: 0;
					}
				}

				.active {
					.tab-text {
						font-size: 28rpx;
						font-family: PingFang SC;
						font-weight: 600;
						color: #262626;
					}

					.tab-active {
						opacity: 1;
					}
				}
			}
		}

		.page-body {
			width: 100%;
			padding-top: 24rpx;

			.list-item {
				width: 100%;
				background: #ffffff;
				margin-bottom: 24rpx;
				padding: 30rpx 0 24rpx 30rpx;

				.order-num {
					width: 100%;
					display: flex;
					justify-content: space-between;
					align-items: center;
					padding-right: 30rpx;

					.order-no {
						font-size: 28rpx;
						font-family: PingFang SC;
						font-weight: 600;
						color: #262626;
					}

					.status {
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: 400;
						color: #8c8c8c;
					}

					.status-red {
						color: #f0250e;
					}
				}

				.split-line {
					width: 100%;
					height: 1px;
					background: #f8f8f8;
				}

				.order-goods {
					width: 100%;
					padding: 30rpx 24rpx 30rpx 0;
				}

				.flex-order {
					display: flex;
					align-items: center;

					.icon-box {
						width: 30rpx;
						height: 30rpx;
						position: relative;
						margin-right: 30rpx;

						.iconfont {
							display: inline-block;
							position: absolute;
							left: -7rpx;
							top: -7rpx;
							z-index: 1;
						}

						.icon-reduce-fill {
							color: #bfbfbf;
							font-size: 44rpx;
						}

						.icon-success-fill {
							color: #f0250e;
							font-size: 44rpx;
						}

						.icon-default {
							width: 30rpx;
							height: 30rpx;
							border: 1px solid #707070;
							border-radius: 50%;
							position: absolute;
							left: 0;
							top: 0;
							z-index: 1;
						}
					}
				}

				.order-foot {
					width: 100%;
					padding-top: 24rpx;
					padding-right: 30rpx;
					display: flex;
					flex-direction: column;
					align-items: flex-end;

					.user-info {
						display: flex;
						align-items: center;
						justify-content: flex-end;

						.name,
						.mobile {
							font-size: 26rpx;
							font-family: PingFang SC;
							font-weight: 400;
							color: #8c8c8c;
						}

						.mobile {
							margin-left: 30rpx;
						}
					}

					.clerk-btn {
						margin-top: 30rpx;
						width: 152rpx;
						height: 60rpx;
						background: #ffffff;
						border: 1px solid #f60313;
						border-radius: 30rpx;
						display: flex;
						justify-content: center;
						align-items: center;
						font-size: 26rpx;
						font-family: PingFang SC;
						font-weight: 400;
						color: #f0250e;
					}
				}
			}
		}

		.page-footer {
			width: 100%;
			background-color: #ffffff;
			position: fixed;
			left: 0;
			bottom: 0;
			z-index: 111;

			.footer-btn {
				width: 100%;
				height: 96rpx;
				background: #ffffff;
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 0 30rpx;

				.footer-left {
					display: flex;
					align-items: center;

					.total-box {
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: 600;
						color: #262626;
					}

					.choose-box {
						margin-left: 20rpx;
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: 400;
						color: #262626;
					}
				}

				.footer-right {
					display: flex;
					align-items: center;
					justify-content: flex-end;

					.cancel {
						width: 160rpx;
						height: 76rpx;
						background: #ffffff;
						border: 1px solid #999999;
						border-radius: 38rpx;
						display: flex;
						justify-content: center;
						align-items: center;
						font-size: 28rpx;
						font-family: PingFang SC;
						font-weight: 600;
						color: #262626;
						margin-right: 24rpx;
					}

					.confirm {
						width: 160rpx;
						height: 76rpx;
						background: #f0250e;
						border-radius: 38rpx;
						display: flex;
						justify-content: center;
						align-items: center;
						font-size: 28rpx;
						font-family: PingFang SC;
						font-weight: 600;
						color: #ffffff;
					}
				}
			}

			.safe {
				padding-bottom: env(safe-area-inset-bottom);
			}
		}
	}

	.scroll-view_H {
		white-space: nowrap;
		width: 90%;
	}

	// .page-list {
	//   width: 100%;
	//   min-height: 100vh;
	//   background: #f2f2f2;
	//   padding-bottom: calc(env(safe-area-inset-bottom) + 100rpx);
	//   .page-header {
	//     width: 100%;
	//     padding-top: 168rpx;
	//     .search-section {
	//       width: 100%;
	//       background-color: #ffffff;
	//       height: 84rpx;
	//       position: fixed;
	//       z-index: 1000;
	//       top: 0;
	//       left: 0;
	//       z-index: 111px;
	//       display: flex;
	//       align-items: center;
	//       justify-content: center;
	//       .input-box {
	//         width: 92vw;
	//       }
	//     }
	//     .top-tabs {
	//       width: 100%;
	//       height: 84rpx;
	//       background: #ffffff;
	//       position: fixed;
	//       left: 0;
	//       top: 84rpx;
	//       z-index: 111;
	//       display: flex;
	//       justify-content: space-between;
	//       align-items: center;
	//       padding: 0 30rpx;
	//       .content-left {
	//         font-size: 28rpx;
	//         font-family: PingFangSC-Medium;
	//         color: rgba(0, 0, 0, 0.85);
	//       }
	//       .content-right {
	//         display: flex;
	//         justify-content: flex-end;
	//         align-items: center;
	//         .iconfont {
	//           color: #262626;
	//           font-size: 40rpx;
	//         }
	//         text {
	//           font-size: 28rpx;
	//           font-family: PingFangSC-Medium;
	//           color: rgba(0, 0, 0, 0.85);
	//         }
	//       }
	//     }
	//   }
	//   .page-body {
	//     width: 100%;
	//     padding-top: 24rpx;
	//     .list-item {
	//       width: 100%;
	//       background: #ffffff;
	//       margin-bottom: 24rpx;
	//       padding: 30rpx 0 0rpx 30rpx;
	//       .order-num {
	//         width: 100%;
	//         display: flex;
	//         justify-content: space-between;
	//         align-items: center;
	//         padding-right: 30rpx;
	//         .order-no {
	//           font-size: 28rpx;
	//           font-family: PingFang SC;
	//           font-weight: 600;
	//           color: #262626;
	//         }
	//         .status {
	//           font-size: 24rpx;
	//           font-family: PingFang SC;
	//           font-weight: 400;
	//           color: #8c8c8c;
	//         }
	//         .status-red {
	//           color: #f0250e;
	//         }
	//       }
	//       .order-goods {
	//         width: 100%;
	//         padding: 30rpx 24rpx 30rpx 0;
	//       }
	//     }
	//   }

	//   .popup-body {
	//     width: 100%;
	//     background-color: #ffffff;
	//     max-height: 80vh;
	//     position: relative;
	//     .popup-header {
	//       display: flex;
	//       justify-content: space-between;
	//       align-items: center;
	//       height: 96rpx;
	//       background: #ffffff;
	//       border-radius: 24rpx 24rpx 0px 0px;
	//       padding: 0 4.8vw;
	//       .close-box {
	//         height: 100%;
	//         display: flex;
	//         justify-content: center;
	//         align-items: center;
	//         .iconfont {
	//           color: #262626;
	//           font-weight: 600;
	//           font-size: 36rpx;
	//         }
	//       }
	//     }
	//     .popup-list {
	//       width: 100%;
	//       padding-left: 4.8vw;
	//       padding-bottom: 8vw;
	//       .goods-list {
	//         width: 100%;
	//         .goods-item {
	//           width: 100%;
	//           border-bottom: 1px solid #f8f8f8;
	//           padding: 24rpx 4.8vw 24rpx 0;
	//         }
	//       }
	//     }
	//   }
	// }
</style>